<%@ page import="myschool.entity.Student" %>
<%@ page import="java.util.*" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
  <%
      Student s=new Student();
      s.setQQ("444444");
      s.setSname("赵润泽");
      s.setStuno(1001L);
      request.setAttribute("student",s);
      request.setAttribute("msg","<span style='color:red;'>李傲平是个大帅哥</span>");
      session.setAttribute("msg","其实老刘页是个大帅哥");
      String []ar={"玛丽莲梦露","Taylor swift","碧昂斯"};
      request.setAttribute("girls",ar);
      request.setAttribute("age",81);

      Map<String,String> pa=new HashMap<>();
      pa.put("dog","小狗");
      pa.put("cat","猫");
      pa.put("pig","猪");
      pa.put("snake","蛇");
      pa.put("sheep","羊");
      request.setAttribute("dict",pa);
      request.setAttribute("now",new Date());
  %>
<h1>学生信息：${student.stuno},${student.sname},QQ:${student.QQ},${student.getQQ()}</h1>
    <h1>${msg}</h1>
    <h1>session中的msg:${sessionScope.msg}</h1>
<h1>下标:${girls[0]}</h1>
<h1>${empty girls}</h1>

<h1>没有的：${sss.fff.ccc}</h1>
<%--<h1>报错：${student.shouji}</h1>--%>
<hr/>
<c:out value="${msg}"/>
<hr/>

 <c:if test="${age>=18}" var="f">
     成年人
 </c:if>
  <c:if test="${age<18}" >
      未成年人
  </c:if>
<hr/>
<c:choose>
    <c:when test="${age>65 }">老年人</c:when>
    <c:when test="${age>45}">中年人</c:when>
    <c:when test="${age>=18}">成年人</c:when>
    <c:otherwise>未成年人</c:otherwise>
</c:choose>
<h1>
    <c:forEach items="${girls}" var="g" varStatus="s">
       ${s.count}: ${g},是不是第一个:${s.first}<br/>
    </c:forEach>
</h1>
<%--  <h2>${dict}</h2>--%>
<h1>循环Map</h1>
<c:forEach items="${dict}" var="d">
    <h2>${d.key}:${d.value}</h2>
</c:forEach>
<h1>${now}</h1>
<h1><fmt:formatDate value="${now}" pattern="yyyy年MM月dd日 H时"/></h1>
</body>
</html>
